package com.example.owner.lettery1.other;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;

import org.jetbrains.annotations.NotNull;

/**
 * Created by Administrator on 2016/10/31.
 */
public class TextTableView extends TableView {
    private TextItemCreator mItemCreator;

    public TextTableView(Context context) {
        super(context);
        init();
    }


    public TextTableView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    private void init() {
        mItemCreator = new TextItemCreator(getContext());
    }

    public void setWeights(int... weights) {
        mItemCreator.setCount(weights.length);
        mItemCreator.setWeights(weights);
    }

    public void setTitles(String... titles) {
        setTitles(mItemCreator, titles);
    }

    public void setVerticalDivider(Drawable divider) {
        mItemCreator.setVerticalDivider(divider);
    }

    public void setAdapter(TextTableAdapter adapter) {
        adapter.setItemCreator(mItemCreator);
        super.setAdapter(adapter);
    }

}
